package com.example.weixinauth.controller;

import com.example.weixinauth.feign.FeignUserService;
import com.weixin.common.core.constant.SecurityConstants;
import com.weixin.common.core.domain.LoginUser;
import com.weixin.common.core.domain.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * @version 1.0.0
 * @className: TestConstller
 * @description:
 * @author: zhangjunfa
 * @date: 2023/2/27 15:26
 */
@Slf4j
@RequestMapping
@RestController
public class TestController {

    private FeignUserService feignUserService;

    public TestController(FeignUserService feignUserService) {
        this.feignUserService = feignUserService;
    }

    @PostMapping("/test")
    public Result<?> test(@RequestParam(name = "username") String username) {
        Result<LoginUser> userInfo = feignUserService.getUserInfo(username, SecurityConstants.INNER);
        log.info("测试");
        return userInfo;
    }

    @GetMapping("/testPwd")
    public Result<?> testPwd() {
        log.info("测试密码");
        return Result.ok("root@1234");
    }
}
